#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
int judge_pwd(char* pwd) {
    int i = 0;
    int count = 0;
    for (; i < strlen(pwd); i++) {
        if ((pwd[i] >= 'A' && pwd[i] <= 'Z')
            || (pwd[i] >= 'a' && pwd[i] <= 'z')
            || (pwd[i] >= '0' && pwd[i] <= '9')) {
            count++;
        }
        if (count >= 2) {
            return 1;
        }
    }
    return 0;
}

int main() {
    int n = 0;
    scanf("%d", &n);
    getchar();

    char pwd[100] = { 0 };
    while (n--) {
        char ch = 0;
        int i = 0;
        while ((ch = getchar()) != '\n') {
            pwd[i++] = ch;
        }

        //scanf("%[^\n]s", pwd);
        //getchar();

        //gets(pwd);

        if ((pwd[0] >= '0' && pwd[0] <= 9)
            || strlen(pwd) < 8 || judge_pwd(pwd) == 0) {
            printf("NO");
            continue;
        }

        printf("YES");
    }


    return 0;
}